<template>
  <div class="pager">
    <button @click="prev" v-if="page > 1">上一页</button>
    <!--<a href="" class="active">1</a>-->
    <!--<a href="">2</a>-->
    <!--<span>...</span>-->
    <!--<a href="">15</a>-->
    <button @click="next" v-if="isNext">下一页</button>
  </div>
</template>

<script>
export default {
  name: 'Pager',
  props: {
    total: {
      type: Number,
      default: 0
    },
    current: {
      type: Number,
      default: 1
    },
    page: {
      type: [Number, String],
      default: 1
    },
    count: {
      type: [Number, String],
      default: 10
    }
  },
  computed: {
    isNext () {
      const p = parseInt(this.page)
      const c = parseInt(this.count)
      if ((p * 10) > c) {
        return false
      } else {
        return true
      }
    }
  },
  methods: {
    prev () {
      this.$emit('prev')
    },
    next () {
      this.$emit('next')
    }
  }
}
</script>
